package chips440.main;

import java.io.Serializable;
import chips440.main.Types.ChangeSet;
import chips440.main.Types.Item;
import java.util.Map;

/**
 * This class defines the so-called packet used by clients to communicate with
 * the server. This is a very small data storage object intended to be
 * serialized and shipped around a lot. To ban Java from making insanely large
 * serialized versions of this class, we made all the members public and had
 * no methods.
 *
 * @author Ian Voysey
 * @version 0.1
 */
public class Packet implements Serializable{
    // quiets a warning
    public static final long serialVersionUID = 1L;

    public ChangeSet changes = ChangeSet.EMPTY;
    public Integer identity = null; // Identity of the client
    public int[][] positions = null;   // Positions of all players
    public int numPlay = 0;         // Number of players desired
    public int time = -1;           // Time left
    public int chips = -1;          // Chips left
    
    public Types.Direct direct = null;      // Direction client wants to move in
    public Types.EngineState state = null;  // State of game
        
    public int tileX = 0;
    public int tileY = 0;
    public String[][] tile = null;      // Name of a tile
    
    public Map<Item, Boolean> items = null;   // Map of all items
    public Item offering = null; 

    /**
     * A better to string for debugging.
     */
    public String toString(){
	return String.format("[%s, %d]", changes, identity);
    }
}
